package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;

@Setter@Getter
public class Customer {
    //这是一行注释,只是用来测试的

    public static final int STATUS_COMMON=0;
    public static final int STATUS_FORMAL=1;
    public static final int STATUS_POOL=2;
    public static final int STATUS_FAILURE=-1;
    public static final int STATUS_LOST=-2;

    private Long id;

    private String name;

    private Integer age;

    private Integer gender;

    private String tel;

    private String qq;

    private SystemDictionaryItem job;

    private SystemDictionaryItem source;

    private Employee seller;

    private Employee inputUser;

    private Date inputTime;

    private Integer status;

    private Date positiveTime;

    public String getJsonString(){
        HashMap<Object, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("age",age);
        map.put("gender",gender);
        map.put("tel",tel);
        map.put("qq",qq);

        if(seller!=null){
            map.put("sellerId",seller.getId());
            map.put("sellerName",seller.getName());
        }
        if(job != null){
            map.put("jobId",job.getId());
        }
        if(source != null){
            map.put("sourceId",source.getId());
        }
        return JSON.toJSONString(map);
    }
}